<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
	</head>
	<body>
		<!-- https://www.payssion.com/payment/create.html  正式-->
		<form id='fm' name="cashU_payment_info" action="http://sandbox.payssion.com/payment/create.html" method="post"><!-- 测试 -->
		    <input type="text" name="api_key" value="72b08351c18be48f">
		    <input type="text" name="api_sig" value="">
		    <input type="text" name="pm_id"  value="unionpay_cn">
		    <input type="text" name="order_id" value="123">
		    <input type="text" name="description" value="payssion test">
		    <input type="text" name="amount" value="2.00">
		    <input type="text" name="currency" value="USD">
		    <input type="text" name="notify_url" value="">
		    <input type="text" name="return_url" value="">
		    <input type="text" name="success_url" value="">
		    <input type ="button" onclick="bom()" value ="Submit">
		</form>
		<button onclick="getOrder()">获取</button>
		<script src="js/app/jquery.min.js"></script>
		<script src="js/app/vconsole.min.js"></script>
		<script src="md5.js"></script>
		<script>
		function bom(){
			var aa=md5('72b08351c18be48f'+'|'+'unionpay_cn'+'|'+'2.00'+'|'+'USD'+'|'+'123'+'|'+'82c67b72a7474dca975fd744fb6c190e')
			$('input[name=api_sig]').val(aa)
			alert($('input[name=api_sig]').val())
			$('#fm').submit()
		}
			function getOrder(){
				//https://www.payssion.com/api/v1/payment/getDetail
				var transaction=GetQueryString('transaction_id');
				alert(GetQueryString('transaction_id'))
				$.ajax({
					type: "post",
					url: "http://sandbox.payssion.com/api/v1/payment/getDetail", 
					data: {api_key:'72b08351c18be48f',transaction_id:transaction,order_id:'123',api_sig:md5('72b08351c18be48f'+'|'+transaction+'|'+'123'+'|'+'82c67b72a7474dca975fd744fb6c190e')},
					dataType:"json",
					contentType:"application/x-www-form-urlencoded; charset=UTF-8",
					success: function(msg){
						console.log(msg);
					}
				});
			}
			
			function GetQueryString (name) {
		          var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
		          var r = window.location.search.substr(1).match(reg)
		          if (r != null) {
		            return unescape(r[2])
		          } else {
		            return null
		          }
		        }
		</script>
	</body>
</html>
